package com.fit.dao.client;

import java.util.List;

import org.apache.tapestry5.ioc.annotations.Inject;
import org.hibernate.Session;

import com.fit.entities.Client;

public class ClientDAOImpl implements ClientDAO {

	@Inject
	private Session session;

	public boolean save(Client client) {
		if (client != null) {
			session.save(client);
			return true;
		} else {
			return false;
		}
	}

	public Client findById(Long id) {
		return (Client) session.get(Client.class, id);
	}

	public List<Client> findAll() {
		return session.createCriteria(Client.class).list();
	}

}
